package com.tianhui.consignortwofei.other.auth;

import android.content.Context;
import android.content.Intent;

import androidx.annotation.Nullable;

import com.tianhui.consignortwofei.other.auth.inte.SelectPhotoCallback;


/**
 * @author fgs
 * @date 2021/5/12
 * @description
 **/
public class PictureContext {
    private PictureStrategy strategy;
    private CheckCameraPermission checkCameraPermission;

    public PictureContext(PictureStrategy strategy) {
        this.strategy = strategy;
    }

    public void selectPhoto(Context context, SelectPhotoCallback callback) {

        if (checkCameraPermission== null){
            checkCameraPermission = new CheckCameraPermission(context);
        }
        if (checkCameraPermission.checkPermission()){
            strategy.selectPhoto(context, callback);
        }
    }



    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        strategy.onActivityResult(requestCode, resultCode, data);
    }
}
